<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="keywords" content="关键字,keywords" />
		<meta name="description" content="描述">
		<title>{:config('webtitle')}</title>
		<link rel="stylesheet" href="__CSS__/bootstrap.css" />
		<link rel="stylesheet" href="__CSS__/style.css" />
		<link rel="stylesheet" href="__CSS__/layui.css" />
		<link rel="stylesheet" href="__CSS__/zrstyle.css" />

		<script type="text/javascript" src="__JS__/jquery-2.1.0.js"></script>
		<script type="text/javascript" src="__JS__/jquery.cookie.js"></script>
		<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
		<script type="text/javascript" src="__JS__/layer/layer.js"></script>
		<style>
			html,
			body {
				background: #FFFFFF;
			}
			
			.layer-anim {
				width: 160px
			}
			
			.psw>input {
				height: 50px;
				line-height: 50px;
				width: 85%;
				border: 1px solid #3f81a5;
				text-indent: 5px;
			}
			.modal-dialog {
				width: 300px;
				text-align: center;
				margin: 320px auto;
			}
			.modal-body p{
				line-height: 25px;
			}
			.a_box{
				width:100%;
				margin-top:30px;
				display: flex;
				justify-items: center;
				align-items: center;
			}
			.a_box a{
				color:#3f81a5;
				margin: 0px auto;
			}
			.a_box>a:hover{
				color:#3f81a5;
				text-decoration: underline;
			}
		</style>
	</head>

	<body>
		<div class="signinwrap">
			<div class="modelbg">

				<div class="signin">
					<div>
						<div class="logo"><img src="__IMG__/signlogo.png" /></div>
						<h3>润泉客户管理系统</h3>
					</div>
					<div class="user">
						<span class="fl usericon"></span>
						<input class="fl" type="text" name="account" placeholder="请输入账号" />
					</div>
					<div class="psw">
						<span class="fl pswicon"></span>
						<input class="fl" type="password" name="password" placeholder="请输入密码" />
					</div>
					{if condition="config('defaultinfo')->iscode eq 1"}
					<div class="code">
						<input type="text" name="code" id="code"/>
						<img id="thiscode" src="{:captcha_src()}" onclick="codes(this)" />
					</div>
					{/if}
					<button class="signinbtn" onclick="submitLogin()">登录</button>
					<div class="signinbot">
						<input class="fl" type="checkbox" value="1" name="free_board" />
						<p class="fl">三天内自动登录</p>
						<a class="fr pointer" onclick="contactadmin()">联系管理员</a>
					</div>
					<div class="a_box" >
						<a href="{:url('operation/index/index')}" >运营中心</a>
						<a href="{:url('administrative/index/index')}" >行政中心</a>
					</div>
				</div>
			</div>
		</div>

		<!-- 联系管理员 -->
		<div class="modal fade" id="contactadmin" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title" id="myModalLabel">联系管理员</h4>
					</div>
					<div class="modal-body">
						<p>管理员:<span>周娟</span></p>
						<p>联系电话:<span>13167817285</span></p>
					</div>
				</div>
			</div>
		</div>
	</body>

</html>

<script>
	//联系管理员
	function contactadmin() {
		$('#contactadmin').modal('show')
	}
	
	$("body").keydown(function() {
		if(event.keyCode == "13") {
			submitLogin();
		}
	});

	function submitLogin() {
		var account = $('input[name="account"]').val();
		var password = $('input[name="password"]').val();
		if(<?php echo (!empty(config('defaultinfo')->iscode)?config('defaultinfo')->iscode:0); ?> == 1) {
			var code = $('input[name="code"]').val();
			if($.trim(code) == '') {
				layer.msg('请填写验证码', {
					icon: 5,
					time: 2000
				});
				return false;
			}
		}
		if($.trim(account) == '') {
			layer.msg('请填写登录帐号', {
				icon: 5,
				time: 2000
			});
			return false;
		}

		if($.trim(password) == '') {
			layer.msg('请填写登录密码', {
				icon: 5,
				time: 2000
			});
			return false;
		}
		var free_board = $('input:checkbox[name=free_board]:checked').val();

		$.post("{:url('Login/doLogin')}", {
			account: account,
			password: password,
			code: code,
			free_board: free_board
		}, function(e) {
			if(e.code == '1') {
				ade(e.url, e.msg);
			} else if(e.code == '-3') {
                $("#code").val('');
                $("#thiscode").attr("src","{:captcha_src()}");
			    layer.msg(e.msg, {
					icon: 5,
					time: 2000
				});
				codes($('#thiscode'));
			} else {
			    layer.msg(e.msg, {
					icon: 5,
					time: 2000
				});
			}
		}, 'json');
	}

	function ade(url, msg) {
		layer.msg(msg, {
			icon: 6,
			time: 2000
		}, function() {
			window.location.href = url;
		});

		/* layer.alert('墨绿风格，点击确认看深蓝', {
		 skin: 'layui-layer-lan'
		 ,closeBtn: 0
		 ,anim: 1 //动画类型
		 ,icon: 6
		 ,time: 2000, //20s后自动关闭
		 },function(){
		 alert(11111)
		 }) */
	}

	function codes(obj) {
		$(obj).attr("src", "{:captcha_src()}");
	}
</script>